<%
'--------------------------------------------------------------------------------------------
'Questa funzione serve a controllare che i file singoli non siano
'richiamati dal browser ma solo da OpenAsp, nel caso in cui il browser tenta di aprire tali file
'l'utente viene subito rimandato alla homepage del sito
'splitto la stringa SQL per recuperare la pagina che si cerca di aprire
i = split(request.ServerVariables("HTTP_URL"), "/")
'confronto il nome del modulo con la funzione Ubound che mi restituisce il massimo
'valore dell'array, quindi il nome della pagina richiesta dall'utente, se coincidono
'rimando alla index
if strComp("admin_news_settings.asp", i(Ubound(i)), 1) = 0 then
  response.redirect request.servervariables("HTTP_REFERER")
end if
%>
<div id="position">
      &raquo; <a href="admin.asp" class="testo">Control Center</a> &raquo; <a href="admin.asp?modulo=news" class="testo"><%=request.QueryString("modulo")%></a> &raquo; <%=traduci("ling_occ_news_13")%>
</div>
<div id="page">
<%

'------------LIMITO IL BLOCCO AI SOLI ADMIN------------
Call onlyADM(session("uID"), "news")
'------------------------------------------------------

Select case request.QueryString("pass")
CASE 0, "":
strSQL = "SELECT * FROM TB_NEWS_CONFIG"
Set cmsRS = addConn.Execute(strSQL)
%>
	<form name="settings" method="post" action="admin.asp?modulo=news&amp;op=admin_news_settings&amp;pass=1">
    
    <p>
    	<label for="NEWS_HOME">    
		<%=traduci("ling_occ_news_12")%>
        </label>
		<input type="text"  class="inputclass" size="30" name="NEWS_HOME" maxlength="3" value="<%=cmsRS("NEWS_HOME")%>" />
	  <font class="testosmall"><%=traduci("ling_occ_news_16")%></font>
	</p>
    <p>
		<label for="NEWS_TOT_PAGE">
		<%=traduci("ling_occ_news_14")%>
        </label>
	 	<input type="text"  class="inputclass" size="30" name="NEWS_TOT_PAGE" maxlength="3" value="<%=cmsRS("NEWS_TOT_PAGE")%>" />
	  <font class="testosmall"><%=traduci("ling_occ_news_16")%></font>	 	 
	</p>
    <p>
		<label for="NEWS_COMM_MAX">
		<%=traduci("ling_occ_news_15")%>
        </label>
	    <input type="text"  class="inputclass" size="30" name="NEWS_COMM_MAX" maxlength="3" value="<%=cmsRS("NEWS_COMM_MAX")%>" />
	     <font class="testosmall"><%=traduci("ling_occ_news_16")%></font>	 	 
	</p>
    <p>
    	<label for="NEWS_ALL_LING">
		<%=traduci("ling_occ_news_19")%>
        </label>
	    <input type="checkbox" size="30" name="NEWS_ALL_LING" value="ok" maxlength="3" <%if cmsRS("NEWS_ALL_LING") = 1 then%>checked<%end if%> />
	</p>
    <p>
		 <input type="submit" class="buttonclass" value="<%=traducisys("ling_111")%>" />
    </p>
   <input type="hidden" name="control" value="cmsset" />
   </form>                    
	<%
 CASE 1:
  if request.Form("control") = "cmsset" then                                                        
   '-----------------------------------------------------------------------------------------
   if request.Form("NEWS_HOME") = "" OR request.Form("NEWS_TOT_PAGE") = "" OR request.Form("NEWS_COMM_MAX") = "" then
   	response.Redirect "admin.asp?modulo=news&op=admin_news_settings"
   elseif NOT isNumeric(request.Form("NEWS_HOME")) OR NOT isNumeric(request.Form("NEWS_TOT_PAGE")) OR NOT isNumeric(request.Form("NEWS_COMM_MAX")) then
   	response.Redirect "admin.asp?modulo=news&op=admin_news_settings"
   end if
	  if request.Form("NEWS_ALL_LING")= "ok" then
	  	ling = 1
	  else
	  	ling = 0
	  end if
	  addConn.Execute("UPDATE TB_NEWS_CONFIG SET NEWS_HOME = '"&testSQLinj(request.Form("NEWS_HOME"))&"', NEWS_TOT_PAGE = '"&testSQLinj(request.Form("NEWS_TOT_PAGE"))&"', NEWS_COMM_MAX = '"&testSQLinj(request.Form("NEWS_COMM_MAX"))&"', NEWS_ALL_LING = '"&ling&"'")
	  call autoReturn("admin.asp?modulo=news&op=admin_news_settings", 2)		
  else
   response.Redirect("admin.asp?modulo=news&op=admin_news_settings&op=0")
  End if
 End select
%>
</div>